Skip to content

Conversation

@irfano
Copy link
Contributor

@irfano irfano commented Oct 22, 2025

Closes WOOMOB-1559

Description

When fetching the first page of the bookings list, we were deleting existing bookings and inserting new ones in two separate database transactions. This caused the UI to briefly display an empty list, resulting in flickering. This PR combines these two operations into a single transaction to resolve the issue.

Steps to reproduce

  1. Open the bookings screen and wait for a moment to ensure the list does not flicker.
  2. Kill the app and relaunch it.
  3. Quickly repeat the steps: open bookings, select the All tab, and choose a booking. Scroll to the bottom, wait for a while, and verify that the screen does not flicker.

The tests that have been performed

Steps above

Images/gif

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Add a new `replaceAllForSite` transactional function to the `BookingsDao`. This function first deletes all bookings for a given site and then inserts the new list of bookings, ensuring atomicity.
The `deleteAllForSite` and `insertOrReplace` calls are replaced with a single `replaceAllForSite` call. This is done within a database transaction, making the operation more efficient.
@irfano irfano added this to the 23.6 milestone Oct 22, 2025
@irfano irfano added the Bug label Oct 22, 2025
@wpmobilebot
Copy link
Collaborator

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit8a2cf76
Direct Downloadwoocommerce-wear-prototype-build-pr14800-8a2cf76.apk

@wpmobilebot
Copy link
Collaborator

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit8a2cf76
Direct Downloadwoocommerce-prototype-build-pr14800-8a2cf76.apk

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.15%. Comparing base (4e3256f) to head (8a2cf76).

Files with missing lines Patch % Lines
...press/android/fluxc/persistence/dao/BookingsDao.kt 0.00% 4 Missing ⚠️
...xc/network/rest/wpcom/wc/bookings/BookingsStore.kt 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14800      +/-   ##
============================================
- Coverage     38.15%   38.15%   -0.01%     
+ Complexity    10059    10058       -1     
============================================
  Files          2129     2129              
  Lines        120211   120215       +4     
  Branches      16439    16439              
============================================
- Hits          45867    45864       -3     
- Misses        69721    69727       +6     
- Partials       4623     4624       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AdamGrzybkowski AdamGrzybkowski self-assigned this Oct 22, 2025
Copy link
Contributor

@AdamGrzybkowski AdamGrzybkowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find @irfano 🔥

@AdamGrzybkowski AdamGrzybkowski merged commit d8b0339 into trunk Oct 22, 2025
19 of 20 checks passed
@AdamGrzybkowski AdamGrzybkowski deleted the issue/WOOMOB-1559-fux-db-transaction-issue-for-bookings branch October 22, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants